Conversation
…tion, and added test file for recipe_api_wrapper class.
…e able to sign in with their github (attempted with google but the process kept rejecting clientID).
…onsive to size changes.
…s to show page of a recipe. Added flash messages (and some styling) for reminder to log-in and successful search.
…ted small aspects to flash message.
…ccounted for properly in conditions in wrapper class, and made update to css styling.
API MuncherWhat We're Looking For
|
| <%= javascript_include_tag "application", 'data-turbolinks-track' => true %> | ||
| <%= csrf_meta_tags %> | ||
| </head> | ||
| <nav> |
There was a problem hiding this comment.
This nav element should be in the body
| <%end%> | ||
| </nav> | ||
|
|
||
| <%if params[:query].nil?%> |
There was a problem hiding this comment.
Maybe simply put main elements with these ids in the views for homepage and search etc.
| @@ -0,0 +1,40 @@ | |||
|
|
|||
| <h2 class="item-header"><%=@recipe.label%></h2> | |||
| <h3 class="item-header">By <%=@recipe.source%></h3> | |||
There was a problem hiding this comment.
This would be an excellent point for a link back to the source of the recipe.
| end | ||
|
|
||
| def show | ||
| @recipe = RecipeApiWrapper.a_recipe(params[:uri]) |
There was a problem hiding this comment.
You should have some error handling for if a recipe isn't found.
| return [] | ||
| end | ||
| a_recipe = recipe.uri_encode | ||
| response = HTTParty.get("https://api.edamam.com/search?app_id=#{APP_ID}&app_key=#{APP_KEY}&r=#{a_recipe}") |
There was a problem hiding this comment.
You should do some error handling for if the API request doesn't work. What if the URI is incorrect? How do you handle it?
| end | ||
| end | ||
| it 'will return [] for a recipe search that is not of string type' do | ||
| VCR.use_cassette("recipe-is-a-string") do |
There was a problem hiding this comment.
What about a call with a URI that's not valid?
| return recipe | ||
| end | ||
|
|
||
| def self.limited_query(query,from,to) |
There was a problem hiding this comment.
This looks like a great candidate for combining with the list_of_queried_recipes method using default parameters for the from and to fields.
| it 'will display index for query within a specific range' do | ||
| session[:user_id].must_equal @jay.id | ||
| VCR.use_cassette("Recipe-controller:recipe-query-range") do | ||
| get query_results_path, params: {from:"1", to: "5", query: "corn"} |
There was a problem hiding this comment.
You should also test with invalid from and to fields
| end | ||
| end | ||
| describe 'Show' do | ||
| it 'will show details of a recipe' do |
| end | ||
| describe 'Logged-in User' do | ||
| before do | ||
| login(@jay) |
There was a problem hiding this comment.
Very good that you're doing this testing.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions